<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'编辑流程：'.$vo['name']))}
	<div class="frame">
		<form method='post' id="form_data" >
			<input type="hidden" id="id" name="id" value="{$vo.id}">
			<input type="hidden" id="opmode" name="opmode" value="edit">
			<input type="hidden" id="ajax" name="ajax" value="1">
			<input type="hidden" id="confirm" name="confirm" >
			<input type="hidden" id="confirm_name" name="confirm_name" >
			<input type="hidden" id="consult" name="consult" >
			<input type="hidden" id="consult_name" name="consult_name">
			<input type="hidden" id="refer" name="refer">
			<input type="hidden" id="refer_name" name="refer_name" >
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="name">名称*：</label>
						
							<input  value="{$vo.name}" class="input" type="text" id="name" name="name" check="required" info="请输入姓名">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="short">简称*：</label>
						
							<input  value="{$vo.short}" class="input" type="text" id="short" name="short" check="required" info="请输入简称">
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="doc_no_format">编号规则*：</label>
						
							<input value="{$vo.doc_no_format}" class="input" type="text" id="doc_no_format" name="doc_no_format" check="required" info="请输入编号规则">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="group">分组：</label>
						<div class="input-block x-select">
							<select class="input" name="tag" id="tag">
								{:fill_option($tag_list)}
							</select>
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="type">审批步骤：</label>
						
							<div id="confirm_wrap" class="input-box">
								<a class="add-on btn-popup-flow"> <i class="fa fa-user"></i> </a>
								<div class="wrap" >
									<span class="address_list">{$vo.confirm_name}</span>
									<span class="text" >
										<input class="letter" type="text"  >
									</span>
								</div>
								<div class="search dropdown ">
									<ul class="dropdown-menu"></ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="type">协商步骤：</label>
						
							<div id="consult_wrap" class="input-box">
								<a class="add-on btn-popup-flow" > <i class="fa fa-user"></i> </a>
								<div class="wrap" >
									<span class="address_list">{$vo.consult_name}</span>
									<span class="text" >
										<input class="letter" type="text"  >
									</span>
								</div>
								<div class="search dropdown">
									<ul class="dropdown-menu"></ul>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="type">其他情况：</label>
						
							<p class="input-static">
								<a class="btn" href="{:url('flow_step','flow_type_id='.$vo['id'])}">修改</a>
							</p>
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="request_duty">申请权限：</label>
						<div class="input-block x-select">
							<select class="input" name="request_duty" id="request_duty">
								{:fill_option($duty_list)}
							</select>
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="report_duty">报告权限：</label>
						<div class="input-block x-select">
							<select class="input" name="report_duty" id="report_duty">
								{:fill_option($duty_list)}
							</select>
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="sort">排序：</label>
						
							<input class="input" type="text" id="sort" name="sort" value="{$vo.sort}">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="is_del">状态：</label>
						<div class="input-block x-select">
							<select class="input" name="is_del" id="is_del">
								<option value="0" >启用</option>
								<option value="1">禁用</option>
							</select>
						</div>
					</div>
				</div>
				<div class="frame">
					<div class="box col-12">
						
							<label class="input-label" for="is_lock">流程类型：</label>
							<div class="input-block x-select">
								<select class="input" name="is_lock" id="is_lock" type="select-one">
									<option value="0" >自由</option>
									<option value="1">固定</option>
								</select>
							</div>
						</div>
					</div>
					<div class="box col-12">
						
							<label class="input-label" for="is_edit">审批人能否修改：</label>
							<div class="input-block x-select">
								<select class="input" name="is_edit" id="is_edit">
									<option value="0">不能修改</option>
									<option value="1">可以修改</option>
								</select>
							</div>
						</div>
					</div>
				</div>
				<div class="frame">
					<div class="box col-12">
						
							<label class="input-label" for="udf_tpl">自定义模板：</label>
							
								<input class="input" type="text" id="udf_tpl" name="udf_tpl" value="{$vo.udf_tpl}">
							</div>
						</div>
					</div>
					<div class="box col-12">
						
							<label class="input-label" for="is_show">默认编辑器：</label>
							<div class="input-block x-select">
								<select class="input" name="is_show" id="is_show">
									<option value="1">显示</option>
									<option value="0">不显示</option>
								</select>
							</div>
						</div>
					</div>
				</div>
				<div class="frame">
					<div class="box col-12">
						
							<div class="col-xs-12">
								<textarea  class="editor textarea" id="content" name="content">{$vo.content}</textarea>
							</div>
						</div>
					</div>
				</div>
				<div class="frame">
					<div class="box col-12">
						
							<a class="btn btn-normal" onclick="save()">保存</a>
							<a  class="btn btn-return" onclick="go_return_url();">取消</a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'uploader', 'editor'], function() {
			var $ = layui.jquery;

			set_return_url();

			set_val("is_del", "{$vo.is_del}");
			set_val("is_edit", "{$vo.is_edit}");
			set_val("is_show", "{$vo.is_show}");
			set_val("tag", "{$vo.tag}");
			set_val("request_duty", "{$vo.request_duty}");
			set_val("report_duty", "{$vo.report_duty}");
			set_val("is_lock", "{$vo.is_lock}");

			$(".btn-popup-flow").on('click', function() {
				winopen("{:url('popup/flow')}", 560, 490);
			});

			$("#btn_save").on('click', function() {
				$("#confirm").val("");
				$("#confirm_wrap  span.address_list span").each(function() {
					$("#confirm").val($("#confirm").val() + $(this).attr("data") + '|');
				});

				$("#confirm_name").val("");
				$("#confirm_name").val($("#confirm_wrap span.address_list").html());

				$("#consult").val("");
				$("#consult_wrap span.address_list span").each(function() {
					$("#consult").val($("#consult").val() + $(this).attr("data") + '|');
				});

				$("#consult_name").val("");
				$("#consult_name").val($("#consult_wrap span.address_list").html());

				$("#refer").val("");
				$("#refer_wrap span.address_list span").each(function() {
					$("#refer").val($("#refer").val() + $(this).attr("data") + '|');
				});

				$("#refer_name").val("");
				$("#refer_name").val($("#refer_wrap span.address_list").html());

				send_form("form_data", "{:url('save')}", "{:url('index')}", function(ret) {
					if (ret.status) {
						layer.msg(ret.info);
						location.reload(true);
					} else {
						layer.msg(ret.info);
						return false;
					}
				});
			});

			$(document).on("dblclick", ".input-box .address_list b", function() {
				$(this).parent().parent().remove();
			});
		});
	</script>
</block>